{include file='public/meta'}
<title>添加房源</title>
{css href='/static/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css'}
</head>
<body>
{include file='public/header'}
{include file='public/menu'}
<link href="/static/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span>
		房源管理
		<span class="c-gray en">&gt;</span>
		添加房源
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="Hui-article">
		<form action="" method="post" class="form form-horizontal" id="form-article-add" enctype="multipart/form-data">
			<!--房源录入员-->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>录入员</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" placeholder="输入录入员" name="checker" value="{$Think.session.uname}" required>
				</div>
			</div>
      <!-- 业主手机号 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>业主姓名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" placeholder="输入业主姓名" name="oname" value="" required>
				</div>
			</div>
      <!-- 联系方式 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系方式：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" placeholder="" name="tel" required minlength=11 maxlength=11>
				</div>
			</div>
			<!--月租-->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>月租：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="2000" name="price" required>
				</div>
			</div>
			<!--整租/合租-->
	      <div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>整租/合租：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<select name="state" id="" class='select' style='width:150px'>
						<option value="整租" selected>整租</option>
						<option value="合租">合租</option>
					</select>
				</div>
			</div>
      <!-- 区域 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>区域：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<!-- <input type="text" name="area" placeholder="输入区/县" class="input-text" style=" width:25%" required>
					<input type="text" name="vill" placeholder="输入小区"" class="input-text" style=" width:25%" required> -->
					<select name="prov" id="prov" class='select' style='width:150px'></select>
					<select name="area" id="area" class='select' style='width:150px'><option value=''>请选择区/县</option></select>
					<select name="vill" id="vill" class='select' style='width:150px'><option value=''>请选择小区</option></select>
			  </div>
			</div>
      <!-- 地址 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>地址：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" name="addr" placeholder="请输入具体地址" class="input-text" required>
				</div>
			</div>
      <!-- 房屋配置 -->
      <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>房屋配置：</label>
        <div class="formControls col-xs-8 col-sm-9 skin-minimal">
          {volist name="inis" id="vo"}
          <div class="check-box">
              <input name="ini[]" type="checkbox" id="ini-{$vo.id}" value="{$vo.id}" required>
              <label for="ini-{$vo.id}">{$vo.info}</label>
          </div>
          {/volist}
        </div>
      </div>
      <!-- 房屋特征 -->
      <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>房屋特征：</label>
        <div class="formControls col-xs-8 col-sm-9 skin-minimal">
          {volist name="characters" id="vo"}
          <div class="check-box">
              <input name="character[]" type="checkbox" id="character-{$vo.id}" value="{$vo.id}" required>
              <label for="character-{$vo.id}">{$vo.info}</label>
          </div>
          {/volist}
        </div>
      </div>
      <!--朝向-->
      <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>房屋朝向：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select name="face" id="" class='select' style='width:150px'>
					<option value="朝南" selected>朝南</option>
					<option value="朝北">朝北</option>
					<option value="朝西">朝西</option>
					<option value="朝东">朝东</option>
				</select>
			</div>
		</div>
      <!-- 房屋描述 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>房屋描述：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" name="desc" value="好房不等人" class="input-text" required>
				</div>
			</div>
      <!-- 小区/周边 -->
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>小区/周边：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" name="trip" value="近地铁,近商超" class="input-text" required>
				</div>
			</div>
      <!-- 缩略图 -->
			<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>缩略图：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <div class="uploader-thum-container">
                    <input type="file" name="thumb[]" class="input-text" multiple>
                </div>
            </div>
        </div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button class="btn btn-primary radius" id="submit" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
				</div>
			</div>
		</form>
	</div>
</section>
{include file='public/footer'}
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
  <script type="text/javascript" src="/static/lib/webuploader/0.1.5/webuploader.min.js"></script> 
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.config.js"></script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript">
  $().ready(function(){
  	$('form').validate({
  		submitHandler:function(form){
  			$(form).ajaxSubmit({
  				type:'post',
  				url:'{:url('admin/renter/do_add')}',
  				dataType:'text',
  				success:function(res){
  					location.reload();
  					layer.msg('添加成功!',{icon:1,time:1000});
  				}
  			})
  		}
  	});
  })

  $(function(){
  	$('.skin-minimal input').iCheck({
  		checkboxClass: 'icheckbox-blue',
  		radioClass: 'iradio-blue',
  		increaseArea: '20%'
  	});
  });

  //地区三级联动
  $(function(){
    $.ajax({
        type:'post',
        url:'{:url('vill_show')}',
        data:'pid=0',
        dataType:'json',
        success:function(res){
            var str = '<option>请选择城市</option>';
            $.each(res.msg,function(key,val){
                str += '<option value='+val.id+'>'+val.name+'</option>';
            })
            $('#prov').html(str);
        }
    });
    $('select[name=prov]').change(function(){
        getData($('select[name=prov]'));
        getData($('select[name=area]'));
    });
    $('select[name=area]').change(function(){
        getData($('select[name=area]'));
    });
})
    
    function getData(obj){
        var val = $(obj).val();
        $.ajax({
            type:'post',
            url:'{:url('vill_show')}',
            data:'pid='+val,
            async:false,
            dataType:'json',
            success:function(res){
                var str = '';
                $.each(res.msg,function(key,val){
                    str += '<option value='+val.id+'>'+val.name+'</option>';
                });
                $(obj).next().html(str);
            }

        });
    }
</script>
</body>
</html>